package com.cn.serverline.lineicp.produce.controller;


import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import com.cn.serverline.lineicp.produce.entity.dto.TeExceptionRecordsAddDto;
import com.cn.serverline.lineicp.produce.entity.dto.TeExceptionRecordsDto;
import com.cn.serverline.lineicp.produce.entity.dto.TeExceptionSecalationAddDto;
import com.cn.serverline.lineicp.produce.entity.dto.TeExceptionSecalationDto;
import com.cn.serverline.lineicp.produce.entity.vo.TeExceptionRecordsVo;
import com.cn.serverline.lineicp.produce.entity.vo.TeExceptionSecalationVo;
import com.cn.serverline.lineicp.produce.service.ITeExceptionSecalationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 异常上报表 前端控制器
 * </p>
 *
 * @author 王凯炫
 * @since 2024-08-22
 */
@RestController
@RequestMapping("/exceptionSecalation")
@ApiResource(name = "异常上报表")
@Api(tags = "异常上报表")
public class TeExceptionSecalationController {

    @Resource(name = "teExceptionSecalationServiceImpl")
    private ITeExceptionSecalationService teExceptionSecalationService;

    /**
     * 添加异常上报
     * @param teExceptionSecalationAddDto
     * @return
     */
    @PostMapping("/add")
    @ApiOperation(value = "添加异常上报")
    public ResponseData add(@RequestBody @Validated TeExceptionSecalationAddDto teExceptionSecalationAddDto) {
        teExceptionSecalationService.add(teExceptionSecalationAddDto);
        return new SuccessResponseData<>("添加成功");
    }


    /**
     * 查询异常上报
     * @param teExceptionSecalationAddDto
     * @return
     */
    @PostMapping("/sel")
    @ApiOperation(value = "查询异常上报")
    public ResponseData<List<TeExceptionSecalationVo>> sel(@RequestBody TeExceptionSecalationDto teExceptionSecalationAddDto) {
        return new SuccessResponseData<>(teExceptionSecalationService.sel(teExceptionSecalationAddDto));
    }

    /**
     *
     * @ApiOperation(value = "查询异常上报详细数据")
     * @param teExceptionRecordsDto
     * @return
     */
    @PostMapping("/select")
    @ApiOperation(value = "查询异常上报详细数据")
    public ResponseData<List<TeExceptionRecordsVo>> select(TeExceptionRecordsDto teExceptionRecordsDto) {
        return new SuccessResponseData<>(teExceptionSecalationService.select(teExceptionRecordsDto));
    }

    /**
     * 添加异常上报详细数据
     * @param teExceptionRecordsAddDto
     * @return
     */
    @PostMapping("/detailsAdd")
    @ApiOperation(value = "添加异常上报详细数据")
    public ResponseData detailsAdd(@RequestBody @Validated TeExceptionRecordsAddDto teExceptionRecordsAddDto) {
        teExceptionSecalationService.detailsAdd(teExceptionRecordsAddDto);
        return new SuccessResponseData<>("添加成功");
    }

}
